package com.tpsix.datascope;

import com.tpsix.controller.vm.RoleVM;
import com.tpsix.domain.SysDept;
import com.tpsix.enums.DataScopeTypeEnum;
import com.tpsix.service.SysDeptService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 所有
 */
@Component
@AllArgsConstructor
public class AllDataScopeHandler implements DataScopeHandler {


    private final SysDeptService sysDeptService;

    @Override
    public List<Integer> getDeptIds(RoleVM roleVM, DataScopeTypeEnum dataScopeTypeEnum) {
        return sysDeptService.list().stream().map(SysDept::getId).collect(Collectors.toList());
    }
}
